<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
    <style>
        .box {
            width: 100px;
            height: 100px;
            background: red;
        }

        .box1 {
            width: 50px;
            height: 50px;
            background: green;
        }

        p {
            width: 20px;
            height: 20px;
            background: #fff;
            overflow: hidden;
        }
    </style>
</head>

<body>
    <!-- 全写 -->
    <div class="box" v-on:click="apple">
        <!-- 简写 -->
        <div class="box1" @click="apples">
            <p @click="appleses">{{msg}}</p>
        </div>
    </div>
</body>

</html>
<script>
    const VM = new Vue({
        el: '.box',
        data: {
            msg: '哈哈哈'
        },
        methods: {
            // 简写
            apple() {
                alert('明天把苹果给吃了')
            },
            // 全写
            apples: function () {
                alert('明天把两个苹果全吃了')
            },
            appleses() {
                this.msg = 'qqqqqqqq'
            }
        }

    })
    VM.appleses()
</script>